Component({
  props: {
    current: Number, // 组件默认选中项
    backgroundColor: {
      type: String,
      value: "#333"
    },
    color: {
      type: String,
      value: "#9e9e9e"
    },
    selectedColor: {
      type: String,
      value: "#ffffff"
    },
    backgroundImg: {
      type: Boolean,
      value: true
    }
  },
  didMount() {
    // 获取组件传参，并更新菜单选中项
    this.setData({
      selected: this.props.current,
      fontColor: this.props.color,
      selectedFontColor: this.props.selectedColor,
    })
  },
  data: {
    selected: 0,
    fontColor: "#9e9e9e",
    selectedFontColor: "#ffffff",
    list: [{
      pagePath: "/pages/index/index",
      text: "记账"
      // }, {
      //   pagePath: "/pages/projectList/projectList",
      //   text: "项目"
      // }, {
      //   pagePath: "/pages/ledger/ledger",
      //   text: "记账"
    }, {
      pagePath: "/pages/day/day",
      text: "我的"
    }]
  },
  methods: {
    goPage(e){
      console.log("准备跳转至我的")
    },
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      console.log("准备跳转至我的",data)
      my.navigateTo({
        url: url,
        success: function (res) {},
        fail: function (err) {
          console.log(err)
        }
      })
    }
  }
})